<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="generator" content="VuePress 2.0.0-beta.25">
    <link rel="icon" href="/eurynome-cloud/images/logo.png"><meta name="keywords" content="Eurynome Cloud,微服务,Spring Boot,Spirng Cloud,Spring Cloud Alibaba,Spring Security,OAuth2,Nacos,Skywalking"><script>var _hmt = _hmt || [];
            (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?376190fed0f613f413a39d7aa19f387d";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script><title>容器化部署 | Eurynome Cloud</title><meta name="description" content="Eurynome Cloud, 在线文档, 微服务, 微服务架构, Spring Boot，Spring Cloud，Spring Cloud Alibaba, Spring Security, OAuth 2, Skywalking, Nacos">
    <link rel="preload" href="/eurynome-cloud/assets/js/runtime~app.64d35c83.js" as="script"><link rel="preload" href="/eurynome-cloud/assets/css/styles.03bfbc71.css" as="style"><link rel="preload" href="/eurynome-cloud/assets/js/567.94e28fdc.js" as="script"><link rel="preload" href="/eurynome-cloud/assets/js/app.a2a09456.js" as="script">
    <link rel="stylesheet" href="/eurynome-cloud/assets/css/styles.03bfbc71.css">
  </head>
  <body>
    <div id="app"><!--[--><div class="theme-container"><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/eurynome-cloud/" class=""><img class="logo" src="/eurynome-cloud/images/logo.png" alt="Eurynome Cloud"><span class="site-name can-hide">Eurynome Cloud</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/eurynome-cloud/documents/" class="nav-link" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/documents-athena/" class="nav-link" aria-label="单体版"><!--[--><!--]--> 单体版 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/microservices/" class="nav-link router-link-active" aria-label="微服务技术栈"><!--[--><!--]--> 微服务技术栈 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>延伸</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a href="/eurynome-cloud/basic-knowledge/" class="nav-link" aria-label="了解基础知识"><!--[--><!--]--> 了解基础知识 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>帮助</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud/issues" rel="noopener noreferrer" target="_blank" aria-label="我要提问"><!--[--><!--]--> 我要提问 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/README.md" class="nav-link" aria-label="常见问题"><!--[--><!--]--> 常见问题 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/更新日志.md" class="nav-link" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a class="nav-link external" href="https://jq.qq.com/?_wv=1027&amp;k=bIerJVy8" rel="noopener noreferrer" target="_blank" aria-label="加入QQ群"><!--[--><!--]--> 加入QQ群 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" placeholder="搜索" autocomplete="off" spellcheck="false" value><!----></form></div></header><div class="sidebar-mask"></div><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/eurynome-cloud/documents/" class="nav-link" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/documents-athena/" class="nav-link" aria-label="单体版"><!--[--><!--]--> 单体版 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/microservices/" class="nav-link router-link-active" aria-label="微服务技术栈"><!--[--><!--]--> 微服务技术栈 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>延伸</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a href="/eurynome-cloud/basic-knowledge/" class="nav-link" aria-label="了解基础知识"><!--[--><!--]--> 了解基础知识 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>帮助</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud/issues" rel="noopener noreferrer" target="_blank" aria-label="我要提问"><!--[--><!--]--> 我要提问 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/README.md" class="nav-link" aria-label="常见问题"><!--[--><!--]--> 常见问题 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/更新日志.md" class="nav-link" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a class="nav-link external" href="https://jq.qq.com/?_wv=1027&amp;k=bIerJVy8" rel="noopener noreferrer" target="_blank" aria-label="加入QQ群"><!--[--><!--]--> 加入QQ群 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item active">微服务技术栈</p><ul class=""><li><!--[--><a href="/eurynome-cloud/microservices/" class="nav-link router-link-active sidebar-item" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/microservices/OAuth2%E6%8E%88%E6%9D%83%E6%A0%87%E5%87%86.html" class="nav-link sidebar-item" aria-label="OAuth2"><!--[--><!--]--> OAuth2 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E6%8A%80%E6%9C%AF.html" class="nav-link sidebar-item" aria-label="容器化技术"><!--[--><!--]--> 容器化技术 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="容器化部署"><!--[--><!--]--> 容器化部署 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#本地容器部署" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="本地容器部署"><!--[--><!--]--> 本地容器部署 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_1-、本地docker安装-windows版" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[1]、本地Docker安装（Windows版）"><!--[--><!--]--> [1]、本地Docker安装（Windows版） <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_2-、安装配置mysql" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[2]、安装配置MySQL"><!--[--><!--]--> [2]、安装配置MySQL <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_2-、安装配置postgresql" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[2]、安装配置PostgreSQL"><!--[--><!--]--> [2]、安装配置PostgreSQL <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_3-、安装配置redis" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[3]、安装配置Redis"><!--[--><!--]--> [3]、安装配置Redis <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_4-、部署kafka、zookeeper、nacos、elk、sentinel-dashboard" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[4]、部署Kafka、Zookeeper、Nacos、ELK、Sentinel Dashboard"><!--[--><!--]--> [4]、部署Kafka、Zookeeper、Nacos、ELK、Sentinel Dashboard <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_5-、部署skywalking" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[5]、部署Skywalking"><!--[--><!--]--> [5]、部署Skywalking <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#_6-、服务打包部署" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="[6]、服务打包部署"><!--[--><!--]--> [6]、服务打包部署 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#服务器容器部署" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="服务器容器部署"><!--[--><!--]--> 服务器容器部署 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#docker打包设计" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Docker打包设计"><!--[--><!--]--> Docker打包设计 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#eurynome-cloud-docker-打包设计初衷" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud Docker 打包设计初衷"><!--[--><!--]--> Eurynome Cloud Docker 打包设计初衷 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#eurynome-cloud-docker-打包的设计" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud Docker 打包的设计"><!--[--><!--]--> Eurynome Cloud Docker 打包的设计 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2.html#eurynome-cloud-docker-打包使用方法" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud Docker 打包使用方法"><!--[--><!--]--> Eurynome Cloud Docker 打包使用方法 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="容器化部署" tabindex="-1"><a class="header-anchor" href="#容器化部署" aria-hidden="true">#</a> 容器化部署</h1><h2 id="本地容器部署" tabindex="-1"><a class="header-anchor" href="#本地容器部署" aria-hidden="true">#</a> 本地容器部署</h2><p>本地采用容器方式进行项目的部署，因为每个人使用的电脑、操作系统都各不相同，加之不同人的喜好和偏好也不尽相同，无法做到全覆盖。</p><div class="custom-container tip"><p class="custom-container-title">提示</p><p>这里仅以容器方式安装<code>Nacos</code>、<code>ELK</code>、<code>Kafka</code>、<code>Zookeeper</code>、<code>Sentinel</code>，本地安装<code>PostgreSQL</code>、<code>MySQL</code>和<code>Redis</code>的方式，进行示意性说明。仅供参考，具体安装请结合自身及时情况，适时调整。</p></div><p><strong>本地安装</strong></p><ul><li>PostgreSQL</li><li>MySQL</li><li>Redis</li></ul><p><strong>容器安装</strong></p><ul><li>Nacos</li><li>ELK</li><li>Kafka &amp; Zookeeper</li><li>Sentinel</li></ul><h3 id="_1-、本地docker安装-windows版" tabindex="-1"><a class="header-anchor" href="#_1-、本地docker安装-windows版" aria-hidden="true">#</a> [1]、本地Docker安装（Windows版）</h3><ul><li>Windows 本地安装 Docker 请参考个人博文：</li></ul><ol><li><a href="https://blog.csdn.net/Pointer_v/article/details/106176846?spm=1001.2014.3001.5501" target="_blank" rel="noopener noreferrer">Windows 10 2004 (20H1) 安装 Docker Desktop for Windows (2.3.0.2) 以 WSL 2 方式运行容器<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://blog.csdn.net/Pointer_v/article/details/106910766?spm=1001.2014.3001.5501" target="_blank" rel="noopener noreferrer">Windows 10 将 Docker Desktop for Windows（WSL 2 方式）文件存储移出C盘放置到其它目录<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li></ol><h3 id="_2-、安装配置mysql" tabindex="-1"><a class="header-anchor" href="#_2-、安装配置mysql" aria-hidden="true">#</a> [2]、安装配置MySQL</h3><ol><li><strong>正常安装MySQL</strong></li><li><strong>创建Nacos持久化数据库</strong></li></ol><p>即在MySQL中，为Nacos新建用户、新建数据库、给数据库用户分配数据库权限。</p><ol start="3"><li><strong>导入Nacos初始脚本</strong></li></ol><p><a href="https://github.com/alibaba/nacos/releases" target="_blank" rel="noopener noreferrer">下载<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>最新稳定版的Nacos压缩包。解压后，在<code>{NACOS_HOME}/conf</code>目录下，找到<code>nacos-mysql.sql</code>导入到数据库中。</p><div class="custom-container tip"><p class="custom-container-title">提示</p><p>在工程的<code>${project home}/configurations/scripts</code>目录下，保存了一份Nacos脚本可以使用，如果不是最新请自行重新下载。</p></div><ol start="4"><li><strong>开放MySQL数据库IP访问</strong></li></ol><p>正常情况下，本地开发使用<code>localhost</code>就可以访问已安装的mysql服务; 因为Docker是使用内部的独立网络，Docker内部容器想要访问外部的数据库，只能通过ip地址才能访问。所以需要开放数据库的IP访问，否则会出现 Docker 容器发无法连接数据库的情况。</p><p>使用命令行工具，登录进入MySQL，输入以下脚本查看数据库的可访问情况：</p><div class="language-mysql ext-mysql line-numbers-mode"><pre class="language-mysql"><code>mysql&gt; select host,user from mysql.user;
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><p>查询结果示例：</p><div class="language-mysql ext-mysql line-numbers-mode"><pre class="language-mysql"><code>| host      | user             |
| --------- | ---------------- |
| localhost | root             |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p><strong>host字段的值是localhost，说明只允许本地访问</strong></p><p>找到对应你所用的用户，设置允许任意IP访问，执行语句：</p><div class="language-mysql ext-mysql line-numbers-mode"><pre class="language-mysql"><code>mysql&gt; update mysql.user set host = &#39;%&#39; where user = &#39;root&#39;;

mysql&gt; flush privileges;
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="_2-、安装配置postgresql" tabindex="-1"><a class="header-anchor" href="#_2-、安装配置postgresql" aria-hidden="true">#</a> [2]、安装配置PostgreSQL</h3><ol><li><strong>安装PostgreSQL数据库</strong></li></ol><p>正常安装即可。跟随安装的Wizard一步一步进行即可。</p><ol start="2"><li><strong>创建应用数据库</strong></li></ol><p>参见：<a href="/eurynome-cloud/documents/%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2.html#%5B2%5D%E3%80%81%E5%88%9B%E5%BB%BA%E6%95%B0%E6%8D%AE%E5%BA%93" class="">创建应用数据</a></p><ol start="3"><li><strong>导入建表数据</strong></li></ol><p>参见：<a href="/eurynome-cloud/documents/%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2.html#%5B5%5D%E3%80%81%E5%AF%BC%E5%85%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E8%84%9A%E6%9C%AC" class="">导入数据库脚本</a></p><ol start="4"><li><strong>开放IP访问</strong></li></ol><p>如果想要使用Docker封装的服务，就需要开放<code>PostgreSQL</code>的IP访问。Windows环境，链接<code>PostgreSQL</code>是主机名填写<code>“localhost”</code>可以正常链接，使用IP地址不能进行链接</p><p>在<code>${PostgreSQL_HOME}/12/data</code>目录下，找到<code>postgresql.conf</code>和<code>pg_hba.conf</code>。</p><ul><li>打开<code>postgresql.conf</code>，在59行，找到<code>listen_addresses</code>，修改为：</li></ul><div class="language-conf ext-conf line-numbers-mode"><pre class="language-conf"><code>listen_addresses = &#39;*&#39;
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>修改端口号打开<code>postgresql.conf</code>，在63行，找到port</li></ul><blockquote><p>PostgreSQL 12 中，该项默认就为 ‘*’，所以可以不用修改</p></blockquote><ul><li>打开<code>pg_hba.conf</code>，在最后增加：</li></ul><div class="language-conf ext-conf line-numbers-mode"><pre class="language-conf"><code>host    all             all             192.168.0.0/16          trust
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><blockquote><p>允许访问PostgreSQL服务器的客户端IP地址, 其中：192.168.0.0/16表示允许192.168.0.1-192.168.255.255网段访问。可根据实际情况调整</p></blockquote><ul><li>重启数据服务</li></ul><h3 id="_3-、安装配置redis" tabindex="-1"><a class="header-anchor" href="#_3-、安装配置redis" aria-hidden="true">#</a> [3]、安装配置Redis</h3><ol><li>安装Redis</li></ol><p>正常安装即可</p><ol start="2"><li>开放IP访问</li></ol><p>在<code>redis</code>安装目录下，找到<code>redis.windows-service.conf</code></p><ul><li>将 <code>56</code> 行 <code>bind 127.0.0.1</code> 注释掉，修改为</li></ul><div class="language-conf ext-conf line-numbers-mode"><pre class="language-conf"><code>#bind 127.0.0.1
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>将 <code>75</code> 行 <code>protected-mode</code> 参数改为 <code>no</code></li></ul><div class="language-conf ext-conf line-numbers-mode"><pre class="language-conf"><code>protected-mode no
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><blockquote><p>生产环境不建议这样，还是要指定具体IP安全一些</p></blockquote><ul><li>重启服务</li></ul><h3 id="_4-、部署kafka、zookeeper、nacos、elk、sentinel-dashboard" tabindex="-1"><a class="header-anchor" href="#_4-、部署kafka、zookeeper、nacos、elk、sentinel-dashboard" aria-hidden="true">#</a> [4]、部署Kafka、Zookeeper、Nacos、ELK、Sentinel Dashboard</h3><p>除了<code>MySQL</code>、<code>PostgreSQL</code>和<code>Redis</code>以外，其它相关运行环境组件 <code>Zookeeper</code>、<code>Kafka</code>、<code>Nacos</code>、<code>ELK</code>、<code>Sentinel Dashboard</code>，可以通过<code>docker-compose</code>方式进行部署，执行以下命令即可：</p><ul><li>运行容器</li></ul><div class="custom-container danger"><p class="custom-container-title">注意：</p><p><code>ELK</code> 依赖一个重要参数 <code>vm.max_map_count</code>，如果这个值小于<code>262144</code>，<code>ELK</code> 会无法正常启动</p><p>一种解决办法</p><p>如果是采用 <code>WSL2</code> 的方式运行容器，那么在Linux中输入以下命令</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token function">sudo</span> -i
<span class="token function">sudo</span> sysctl vm.max_map_count<span class="token operator">=</span><span class="token number">524288</span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>然后在启动Docker Desktop</p><p>另一种解决办法：</p><ul><li>open powershell</li><li>wsl -d docker-desktop</li><li>echo &quot;vm.max_map_count = 262144&quot; &gt; /etc/sysctl.d/99-docker-desktop.conf</li></ul><p>参考 : <a href="https://github.com/docker/for-win/issues/5202" target="_blank" rel="noopener noreferrer">https://github.com/docker/for-win/issues/5202<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></p></div><div class="custom-container tip"><p class="custom-container-title">说明</p><p>已经将Dockerfile以及docker-compose修改为参数运行。</p><p>因此运行一下命令时，请确保.env 文件在执行命令的目录下。</p><p>例如：如果在<code>C:\Users\Administrator\Desktop</code>执行命令，那么<code>.env</code>文件，就需要在<code>C:\Users\gengwei.zheng\Desktop</code>目录下</p></div><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project_home}/configurations/docker/docker-compose/herodotus/env.base.yml up -d
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><blockquote><p>该命令会查看本地是否已经有了相关镜像，如果没有会首先下载镜像，然后再运行，请先保证网络畅通</p></blockquote><ul><li>停止容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project_home}/configurations/docker/docker-compose/herodotus/env.base.yml stop
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>停止并删除容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/env.base.yml down
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h3 id="_5-、部署skywalking" tabindex="-1"><a class="header-anchor" href="#_5-、部署skywalking" aria-hidden="true">#</a> [5]、部署Skywalking</h3><div class="custom-container warning"><p class="custom-container-title">注意</p><p>由于 <code>Skywalking</code> 采用 <code>Elasticsearch</code> 进行数据存储，因此 <code>Skywalking</code>运行之前，要保证 <code>Elasticsearch</code> 已经正常运行。</p><p>虽然docker-compose有depends_on属性，但是该属性只能解决容器启动的先后顺序问题，并不能实现某一个容器及容器内部所有应用启动成功之后再运行的问题。</p><p>因此，这里将环境依赖的应用，拆分为两个<code>docker-compose</code>文件，</p><ul><li>先运行<code>${project_home}/configurations/docker/docker-compose/herodotus/env.base.yml</code>，待所有容器及内部服务成功运行之后，</li><li>再运行<code>${project_home}/configurations/docker/docker-compose/herodotus/env.skywalking.yml</code></li></ul></div><p>通过docker-compose方式进行部署，执行以下命令即可：</p><ul><li>运行容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project_home}/configurations/docker/docker-compose/herodotus/env.skywalking.yml  up -d
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><blockquote><p>该命令会查看本地是否已经有了相关镜像，如果没有会首先下载镜像，然后再运行，请先保证网络畅通</p></blockquote><ul><li>停止容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project_home}/configurations/docker/docker-compose/herodotus/env.skywalking.yml stop
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>停止并删除容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project_home}/configurations/docker/docker-compose/herodotus/env.skywalking.yml down
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h3 id="_6-、服务打包部署" tabindex="-1"><a class="header-anchor" href="#_6-、服务打包部署" aria-hidden="true">#</a> [6]、服务打包部署</h3><p>在命令行中，执行以下命令即可</p><ul><li>运行容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/services.dev.yml --env-file=${project_home}/configurations/docker/docker-compose/herodotus/.env up -d
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><blockquote><p>该命令会查看本地是否已经有了相关镜像，如果没有会首先构建镜像，然后再运行，请先保证网络畅通</p></blockquote><ul><li>停止容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/services.dev.yml --env-file=${project_home}/configurations/docker/docker-compose/herodotus/.env up -d stop
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>停止并删除容器</li></ul><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/services.dev.yml --env-file=${project_home}/configurations/docker/docker-compose/herodotus/.env up -d down
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h2 id="服务器容器部署" tabindex="-1"><a class="header-anchor" href="#服务器容器部署" aria-hidden="true">#</a> 服务器容器部署</h2><div class="custom-container tip"><p class="custom-container-title">提示</p><p>应用环境的部署是一项大工程，同样的基础设施根据不同应用场景需求，可以采用多种多样不同的方式进行部署。基础设施的部署也比较复杂，其中任意一项都可以单独作为专门话题进行讨论。这就是所谓的“<strong>千人千面</strong>”， 而且基础设施部署并不是本项目的重点，所以此处不再展开。当然，只要是技术问题，欢迎在群里积极讨论交流。</p></div><p>使用Docker-compose打包Docker，参见[Eurynome Cloud Docker 打包使用方法](#Eurynome Cloud Docker 打包使用方法)</p><h2 id="docker打包设计" tabindex="-1"><a class="header-anchor" href="#docker打包设计" aria-hidden="true">#</a> Docker打包设计</h2><h3 id="eurynome-cloud-docker-打包设计初衷" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-docker-打包设计初衷" aria-hidden="true">#</a> Eurynome Cloud Docker 打包设计初衷</h3><p>Eurynome Cloud Docker 打包的设计，采取了与大多数开源微服务框架不同的方式。采取这种不同的方式进行打包，主要是考虑解决以下两方面问题：</p><h4 id="_1-、skwalking-agent的引入问题" tabindex="-1"><a class="header-anchor" href="#_1-、skwalking-agent的引入问题" aria-hidden="true">#</a> [1]、Skwalking Agent的引入问题</h4><p>系统中为了解决服务链路跟踪及监控的问题，引入了Skywalking组件。Skywalking想要正确运行，除了要保证Skywalking Server的<a href="%5B5%5D%E3%80%81%E9%83%A8%E7%BD%B2Skywalking">正常运行</a>外，还要将Skywalking&quot;注入&quot;到服务的运行环境中。</p><ol><li>如果是以<code>fat jar</code>的方式运行服务，需要在服务的运行命令中指定Skywalking Agent以及相关的参数，如下命令</li></ol><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>java -javaagent:/skywalking-agent.jar<span class="token operator">=</span>agent.service_name<span class="token operator">=</span><span class="token variable">${SW_AGENT_SERVICE_NAME}</span>,collector.backend_service<span class="token operator">=</span><span class="token variable">${SW_COLLECTOR_BACKEND_SERVICE}</span> <span class="token variable">${JAVA_OPTS}</span> -jar /app.jar
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ol start="2"><li>如果是以Docker的方式运行服务，传统的方式就需要把<code>skywalking-agent.jar</code>一并打入到服务的docker中。</li></ol><p>由于Docker-compose打包上下文的问题，就需要在每一个模块中都复制一份skywalking-agent.jar。很不好管理，看着也不舒服。</p><h4 id="_2-、dockerfile的编写和放置问题" tabindex="-1"><a class="header-anchor" href="#_2-、dockerfile的编写和放置问题" aria-hidden="true">#</a> [2]、Dockerfile的编写和放置问题</h4><p>常规Java微服务的Docker打包方式，要么采用Maven Plugin的方式，要么采用docker-compose的方式。不管哪一种方式，都需要在该服务代码所在目录下新建一个Dockerfile文件。</p><p>一方面，每个服务下的Dockerfile文件中的配置信息，除了服务的JAR包名不同以外，其余的所有配置都相同，就是一种重复劳动。 另一方面，如果要增加Skywalking，那么需要在每一个服务所在目录下都拷贝一份<code>skywalking-agent.jar</code>。不仅重复工作，代码结构也不美观整洁。</p><h3 id="eurynome-cloud-docker-打包的设计" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-docker-打包的设计" aria-hidden="true">#</a> Eurynome Cloud Docker 打包的设计</h3><p>为了解决上述两方面问题，<code>Eurynome Cloud</code> 在所有模块之外之指定了一个统一的目录，将需要打包的jar以及dockerfile全部放入该目录，通过该目录形成一个统一的上下文环境。在<strong>Eurynome Cloud</strong>工程中，<code>${project_home}/configurations/docker/context</code>就是这个上下文环境。</p><p>在这个上下文环境中，除了包含通用的Dockerfile、Skywalking Agent以外，在使用Maven进行编译的过程中，还会将所有需要打包服务的对应的jar包拷贝到<code>${project_home}/configurations/docker/context/target</code>目录下。这样打包的所有资源就都已经具备，同时还解决了上述两个问题。</p><div class="custom-container tip"><p class="custom-container-title">提示</p><p>可以通过修改<code>${project_home}/pom.xml</code> 中的<code>&lt;docker.build.directory&gt;</code>值，来改变拷贝jar包的目录</p></div><h3 id="eurynome-cloud-docker-打包使用方法" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-docker-打包使用方法" aria-hidden="true">#</a> Eurynome Cloud Docker 打包使用方法</h3><h4 id="_1-、修改信息" tabindex="-1"><a class="header-anchor" href="#_1-、修改信息" aria-hidden="true">#</a> [1]、修改信息</h4><p>由于使用了一个统一的Dockerfile来解决重复定义Docker打包配置文件的问题，想要实现使用一个Dockerfile打出不同的Docker，那么就需要通过传参的方式来改变Dockerfile中的值。</p><p>这里采用的是环境变量的方式，在<code>${project_home}/configurations/docker/docker-compose/.env</code>文件中定义这些参数。其中包含版本号以及具体服务对应的包名。所以如果有新增服务或者想要指定版本号，首先就需要修改这个配置文件。</p><h4 id="_2-、执行命令" tabindex="-1"><a class="header-anchor" href="#_2-、执行命令" aria-hidden="true">#</a> [2]、执行命令</h4><p>执行打包命令</p><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/services.dev.yml --env-file=${project_home}/configurations/docker/docker-compose/herodotus/.env up -d
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><p>或者</p><div class="language-docker ext-docker line-numbers-mode"><pre class="language-docker"><code>docker-compose -f ${project home}/configurations/docker/docker-compose/herodotus/services.prod.yml --env-file=${project_home}/configurations/docker/docker-compose/herodotus/.env up -d
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><div class="custom-container tip"><p class="custom-container-title">说明</p><p>上文说到想要以Docker的方式运行服务并且关联Skywalking，就需要在打包时将Skywalking Agent打入到Docker中。但实际应用中并不是所有环境都需要使用Skywalking，比如：在生产环境需要使用Skywalking，在开发环境中并不需要Skywalking以降低资源消耗。</p><p>因此，Eurynome Cloud 提供了两种打包配置</p><p>使用<code>${project home}/configurations/docker/docker-compose/herodotus/services.dev.yml</code>这个Docker-compose配置文件打包时，对应的Dockerfile文件是<code>${project home}/configurations/docker/context/development/Dockerfile</code>。这个Dockerfile配置中，没有包含Skywalking Agent的拷贝命令。</p><p>使用<code>${project home}/configurations/docker/docker-compose/herodotus/services.prod.yml</code>这个Docker-compose配置文件打包时，对应的Dockerfile文件是<code>${project home}/configurations/docker/context/production/Dockerfile</code>。这个Dockerfile配置中，包含了Skywalking Agent的拷贝命令。</p><p>这样通过不同的命令，实现了对不同Docker环境需求的支持。</p></div><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">更新时间: </span><span class="meta-item-info">2021/9/8 上午12:03:33</span></div><div class="meta-item contributors"><span class="meta-item-label">贡献者: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: pointer_v@qq.com">herodotus</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"> ← <a href="/eurynome-cloud/microservices/%E5%AE%B9%E5%99%A8%E5%8C%96%E6%8A%80%E6%9C%AF.html" class="nav-link" aria-label="容器化技术"><!--[--><!--]--> 容器化技术 <!--[--><!--]--></a></span><!----></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
    <script src="/eurynome-cloud/assets/js/runtime~app.64d35c83.js" defer></script><script src="/eurynome-cloud/assets/js/567.94e28fdc.js" defer></script><script src="/eurynome-cloud/assets/js/app.a2a09456.js" defer></script>
  </body>
</html>
